The present invention relates to velocity determination of a moving object based on sensed position.
Measurements of velocity for electromechanical systems may be obtained in a number of ways, including the use of dedicated sensors such as tachometers and the taking of derivatives of signals from position sensors such as potentiometers and optical encoders. Hardware and software approaches can calculate these derivatives. For example, a simple operational amplifier circuit can differentiate an analog potentiometer signal to output a velocity signal, or the same potentiometer signal may be differentiated in software. Both approaches introduce lag into the velocity estimate. Filtering in hardware or software to cope with the derivative""s sensitivity to noisy sensor data further worsens the lag, sometimes to the point that the velocity data becomes useless.
Due to their optical, non-contact design, encoders have a long service life, low friction, excellent repeatability, and inherently digital outputs with low noise. These attributes have made them popular position sensors. In applications requiring velocity as well as position information, designers often would like to obtain velocity information from an optical encoder rather than accept the added expense of an analog velocity sensor and its associated analog-to-digital conversion electronics. Software techniques for doing so have existed for some time. Two possible approaches include measuring the change in position (number of encoder pulses) over a fixed period of time, and measuring the period of time required to attain a fixed position change (the period of one encoder pulse, for example).
The first technique, pulse counting, can be useful at higher encoder speeds where pulses occur frequently, leading to acceptable quantization error and dynamic range in the velocity measurement. For slower speeds seen in electromechanical applications such as haptic feedback or xe2x80x9cforce feedbackxe2x80x9d devices, this technique becomes problematic. Consider the extreme case where the encoder moves so slowly that only one pulse count occurs in the given time period. If speed gradually increases until two pulse counts are measured, estimated velocity will suddenly double. The quantization error in this case is almost 100%. The application of smoothing algorithms may help (or simply create lag-induced instability in some systems), but cannot eliminate this fundamental problem.
The second technique, period counting, appears more attractive for measurements of slower velocities. With the ability to measure an infinitely long period, the slowest velocity may be measured. The resolution of the time measurement will determine the fastest measurable velocity. The equation for period counting:   ω  =                    2        ⁢        π            T        =                  2        ⁢        π            period      
where xcfx89 is the angular speed of a rotating shaft. This technique has some implementation difficulties. Accurate period measurement requires an interrupt-driven time counter. Measuring time in this fashion with frequent encoder pulses and one or more sensing channels can severely tax a computer that must simultaneously handle other tasks (graphics, kinematics, modeling, etc.). It can also be costly on an embedded processor of more humble means. In addition to frequent interrupts, it requires an inversion to convert from period to velocityxe2x80x94this operation can be time-intensive or not available on low-end microcontrollers.
Principles of Optical Encoder Operation
Optical encoders use paired light sensors and light sources with mechanical interruptions to measure rotary or linear position. FIG. 1 is a diagram of an incremental rotary optical encoder 10 attached to a motor shaft 12 of a motor 14 to measure the angle of rotation of the shaft. A light source 16 emits a beam of electromagnetic energy toward a light sensor or detector 18 through an encoder disk 20 which is transparent or includes open slots. An encoder hub 22 couples the disk 20 to the shaft 12. See R. D. Klafter, T. A. Chmielewski, and M. Negin, xe2x80x9cRobotic Engineering: An Integrated Approach,xe2x80x9d Prentice-Hall, Englewood Cliffs, N.J., 1989, incorporated herein by reference. FIG. 2 shows the face of the optical encoder disk 20, with a striped pattern 24 that provides periodic interruptions between the light source and light sensor as the motor shaft rotates.
The encoder 10 of FIG. 1 preferably uses two emitter-detector pairs (both emitters included in the light source 16 and both detectors included in the light sensor 18). If only one pair is used, the single output signal indicates motion, but cannot indicate which direction the encoder disk/shaft is turning. A practical encoder requires the addition of a second emitter-detector pair slightly offset from the first so that it produces a square wave pulse stream that is 90 (electrical) degrees out of phase with the first pulse stream. FIG. 3a is a diagrammatic illustration of the two signals 26 (channel A) and 28 (channel B) output by two detectors included in the light sensor 18 during clockwise rotation of the encoder disk 20. FIG. 3b is a similar illustration of the two signals 26 and 28 output during counterclockwise rotation of the encoder disk. Thus, the relative phases of the two signals provides an indication of the direction of rotation. The logic level outputs of the A and B channels of the incremental encoder are that A leads B when clockwise rotation occurs, and A lags B when counterclockwise rotation occurs.
FIG. 4 is a block diagram illustrating the components of a signal processing system 30 for an incremental optical encoder signal. Incremental optical encoders count pulses from the emitter-detector pairs in light source 16 and light sensor 18. A quadrature decoder state machine 32 receives the two channels from the detector pair and outputs a direction signal and a count strobe to a counter 34. Rotation of the disk 20 in one direction causes the counter to count up, and rotation in the other direction causes the counter to count down. Count and least significant bits are provided to a position register 36 which provides a position signal to a component that can process it, such as a controller or microprocessor. Because this arrangement can only measure a relative change from a starting position, if the application requires knowledge of absolute position the system must be powered up (or the counter reset) with the shaft in a known position. Inherently absolute optical encoders that use several pairs of light sensors and sources are also available. An absolute encoder has a more complicated Grey-code-based codewheel (or strip, in the case of a linear sensor) to interrupt the light beams. Though the encoder velocity techniques presented in this work can easily be applied to absolute encoders, a detailed description of their function is not presented. For further detail, see Klafter et al.
Encoders are useful in many applications. More specifically, computer interface devices such as joysticks, mice, track balls, steering wheels, etc. make use of encoders to determine the position of a user manipulatable object (manipulandum) in a workspace of the user object, and provide the position information to a host computer that is connected to the interface device. An encoder can be used to sense position of the manipulandum in one or more degrees of freedom. Force feedback interface devices are a form of interface device in which motion of the manipulandum is sensed and forces are output on the manipulandum using actuators such as motors. In some preferred force feedback interface device implementations, a local microprocessor, separate from the host computer, is included in the interface device to offload computational burden from the host computer. The local microprocessor can handle force computations and position processing, allowing the host to concentrate on running a host application and displaying environments on a display screen in part based on position information from the interface device.
The digital precision of encoders is even more valuable for use in force feedback interface devices, which often use velocity information in addition to position information describing motion of the manipulandum to determine and output forces on the manipulandum. Velocity determination of the manipulandum is essential for outputting realistic forces such as damping forces.
The prior art has used encoders for velocity measurement. M. Lemkin et al., xe2x80x9cVelocity Estimation From Widely Spaced Encoder Pulses,xe2x80x9d American Control Conference, Seattle, Wash., 1996, pp. 998-1002, refers to a Luenberger observer-based estimator to enable velocity estimation from widely-spaced encoder pulses. Their work includes a finite state machine approach for slowly-moving systems. R. H. Brown, S. C. Schneider, M. G. Mulligan, xe2x80x9cAnalysis of algorithms for velocity estimation from discrete position versus time data,xe2x80x9d IEEE Transactions on Industrial Electronics, vol. 39, no. 1, pp. 11-19, 1992 investigates the performance of three different algorithms for velocity estimation from discrete position versus time data: Taylor series expansion, backward difference expansion, and least-squares fit. T. Ohmae, et al., xe2x80x9cA Microprocessor-Controlled High-Accuracy Wide-Range Speed Regulator for Motor Drives,xe2x80x9d IEEE Trans. On Industrial Electronics, Vol. IE-29, No. 3, 1982, pp. 207-211, presents a microprocessor-controlled encoder velocity-based speed regulator for motor drives. K. Saito et al., xe2x80x9cA Microprocessor-Controlled Speed Regulator with Instantaneous Speed Estimation for Motor Drives,xe2x80x9d IEEE Trans. On Industrial Electronics, Vol. 35, No. 1, 1988, presents an instantaneous speed estimation approach. R. L. Anderson et al., U.S. Pat. No. 5,740,083, Apr. 14, 1998, describes a method that appears to apply three different equations to process reciprocal velocity data in a microprocessor. P. Sagues, U.S. Pat. No. 4,639,884, Jan. 27, 1987, appears to be relevant to reciprocal velocity methods, as well as position interpolation, using evenly-spaced clock pulses. P. Bhatti et al., xe2x80x9cSingle Chip Velocity Measurement System for Incremental Optical Encoders,xe2x80x9d submitted to IEEE Transactions on Control Systems Technology, 1997, implements both pulse counting and period counting in an FPGA. For example, one method can automatically select between the best of the two methods (frequency counting for high velocities and period counting for low velocities).
The prior art has used a 1/T estimation to determine velocity, i.e., two successive positions of a moving object are obtained from an encoder and the difference in position is divided by the time period elapsing between positions, according to the standard velocity relation v=d/T. The traditional 1/T velocity estimation technique and its linear-with-time counting method have several drawbacks. First, 1/T velocity estimation requires a microprocessor or other controller to perform a division operation to obtain velocity. This can be costly in terms of computational resources on embedded microprocessors/microcontrollers, such as a microprocessor local to a force feedback interface device (or in a host computer). Further, it means that velocity information is not directly available to the digital hardware without first passing the information to a microprocessor or host computer (e.g. when performing damping calculations for damping forces in hardware, such as a xe2x80x9chaptic acceleratorxe2x80x9d device provided on an interface device in addition to a local microprocessor, as described in U.S. Pat. No. 5,999,168).
Second, linear counting of encoder periods using constant time increments (e.g. a constant clock interval) creates a nonlinear mapping to velocity (see FIG. 5a, described below). This means that the discrete values of velocity obtainable from the discretized period measurements will not be distributed evenly throughout the velocity range. The nonlinear mapping has a serious practical implication: it concentrates velocity resolution at the lower velocities. This forces an increase in clock speed to allow acceptable resolution at high velocities. A faster clock speed causes the period counter to overflow more quickly, reducing the largest measurable period and thus increasing the slowest measurable speed. Viewed differently, the size of the counter represents the dynamic range. For long periods associated with slow velocities, a constant-rate counter still xe2x80x9cuses upxe2x80x9d counts (dynamic range) very fast, even though the high period resolution is wasted. In this way, the nonlinear velocity resolution distribution severely restricts dynamic range. The designer must settle for a slower maximum velocity in order to have adequate period-count resolution, or must settle for a faster minimum velocity in order to prevent counter overflow.
A different problem relates to force output by an actuator controlled by pulse width modulation (PWM) or digital output techniques. These systems provide discrete values to an actuator, where a single value is provided to the actuator to be output for a length of time, until the next discrete value is received and sent to the actuator. Stability problems can be encountered attributable to prior art zero-order hold systems, which receive a value and hold the actuator output at the received value until the next PWM value is received. Over and under-estimates of the required actuator force output at each discrete interval can add up to create instabilities. For example, the next value may be greatly different from the current held output force magnitude, causing a large, abrupt change in force output. This can be disconcerting to a user of a force feedback device, which expects to experience realistic forces.
The apparatus and method of present invention is directed to velocity determination of a moveable object using a nonlinear sensing technique. The technique allows a direct estimation of velocity to be provided to a controller or processor and increases the dynamic range of velocity sensing. A method and apparatus for providing continuous first-order force output decreases instabilities in actuator systems.
More particularly, a method of the present invention for determining a velocity of a moving object includes receiving a signal from an encoder indicating that the encoder has detected the passage of a point on a moving sensor element, such as a mark on an encoder disk. The encoder, for example, can include a pattern of marks which moves as the object moves, wherein passage of the marks is detected by the encoder to detect movement of the object. The provided signal can be a rising or falling edge signal. A counter is made to count down from a higher value to a lower value after the encoder signal has been received, where counts by the counter are made at a variable, nonlinear rate. The rate is faster when the count begins and gets slower as the count continues, thereby reducing the possibility that the counter will overflow before the next signal is received from the encoder. The value of the counter is output as a value directly related to the velocity of the object, where the value is a current value of the counter at the time a successive signal from the encoder is received.
The counter can be reset when another signal or pulse from the encoder is received, such that when a velocity of the moving object is greater, the counter is reset more quickly and the counting rate does not get as low as when the velocity of the object is lower, i.e. the count rate of the counter gets slower as the time interval between successive pulses gets longer. Thus, the count of the counter bears a direct linear relationship to the velocity of the object, i.e. the velocity bears an inverse relationship to a time period between the signals from the encoder. This allows the counter value to be directly proportional to velocity and increases the dynamic range of velocity estimation.
The counting rate is varied in one described embodiment by providing different divisors to a frequency divider, the frequency divider controlling when the counter makes another count. The frequency divider receives a high-frequency base clock signal and divides a frequency of the base clock signal by the divisor. A different divisor is provided to the frequency divider based on a current value of the counter. Preferably, the different divisors are stored in a look up table. The divisors can be determined by an iterative search of slopes to find a slope approximating a 1/T relationship; alternatively, the divisors can be determined from a 1/T2 relationship, where T is the time period between signals from the encoder. The signal from the encoder can be in one of two channels in a quadrature scheme, each of the channels directing signals from an associated detector included in the encoder. In a circuit implementation of the present invention, a decoder state machine can receive the signal from the encoder, and a velocity register can receive the output counter value and provide the value to a controller such as a microprocessor. A nonlinear period counter can include the above variable frequency divider, velocity counter, and lookup table. In one desired application, the moving object can be a manipulandum or member included in a force feedback interface device. Furthermore, the output value of the counter is used by a microprocessor or hardwired circuit to determine a force to be output to the object by actuators.
In a different method and apparatus of the present invention, values are provided to an actuator to output as forces. For example, the forces can be output as force sensations in a force feedback interface device. A first command to output a specified first force value is received, followed by a second command to output a specified second force value. The first and second values are differenced and the difference and a time period elapsing between the first and second commands are used to determine a rate of change of the force values. A force value is output as a force according to the rate of change until another command is received to output a specified third force value. Preferably, the commands are pulse width modulation (PWM) commands or Digital-to-Analog commands. The second force value can be stored in a counter and count pulses can be provided to the counter at the determined rate of change. The count pulses can be provided by a variable-rate pulse generator which divides a frequency of a base clock signal similar to the velocity estimation described above.
The present invention advantageously provides a velocity estimation apparatus and method which provides a nonlinear counter having a count that maps linearly to velocity of a measured object. This allows velocity resolution to be distributed more evenly in the velocity range, thereby increasing the dynamic range of the velocity determination and allowing a faster maximum velocity or a slower minimum velocity to be sensed than when used previous velocity determination techniques. The first order force output apparatus and method of the present invention allows a smoother, more continuous force output between the receiving of discrete force values, which in turn reduces the instability of the force output.